﻿Public Class RtpoUsoInmueble

    Public Shared Function SeleccionarTodo(ByVal descEmpresa As String, ByVal DisplaySelect As Boolean) As List(Of EtpoUsoInmueble)
        Dim tpoUsoInmuebles As List(Of EtpoUsoInmueble) = Nothing

        Dim options As New TransactionOptions
        options.IsolationLevel = Transactions.IsolationLevel.ReadCommitted
        options.Timeout = New TimeSpan(0, 2, 0)

        Using scope As New TransactionScope(TransactionScopeOption.Required, options)
            Try
                tpoUsoInmuebles = DtpoUsoInmueble.SeleccionarTodo(descEmpresa)
                If tpoUsoInmuebles Is Nothing Then tpoUsoInmuebles = New List(Of EtpoUsoInmueble)
                If DisplaySelect Then tpoUsoInmuebles.Insert(0, New EtpoUsoInmueble("00", "-- SELECCIONAR --"))
                scope.Complete()
            Catch ex As Exception
                Throw
            End Try
        End Using

        Return tpoUsoInmuebles
    End Function
    Public Shared Function SeleccionarXEstado(ByVal descEmpresa As String, ByVal DisplaySelect As Boolean) As List(Of EtpoUsoInmueble)
        Dim tpoUsoInmuebles As List(Of EtpoUsoInmueble) = Nothing

        Dim options As New TransactionOptions
        options.IsolationLevel = Transactions.IsolationLevel.ReadCommitted
        options.Timeout = New TimeSpan(0, 2, 0)

        Using scope As New TransactionScope(TransactionScopeOption.Required, options)
            Try
                tpoUsoInmuebles = DtpoUsoInmueble.SeleccionarXEstado(descEmpresa)
                If tpoUsoInmuebles Is Nothing Then tpoUsoInmuebles = New List(Of EtpoUsoInmueble)
                If DisplaySelect Then tpoUsoInmuebles.Insert(0, New EtpoUsoInmueble("00", "-- SELECCIONAR --"))
                scope.Complete()
            Catch ex As Exception
                Throw
            End Try
        End Using

        Return tpoUsoInmuebles
    End Function
    Public Shared Function Añadir(ByVal descEmpresa As String, ByVal ptpoUsoInmueble As EtpoUsoInmueble) As Boolean
        Dim resultado As Boolean = False

        Dim options As New TransactionOptions
        options.IsolationLevel = Transactions.IsolationLevel.ReadCommitted
        options.Timeout = New TimeSpan(0, 2, 0)

        Using scope As New TransactionScope(TransactionScopeOption.Required, options)
            Try
                resultado = DtpoUsoInmueble.Añadir(descEmpresa, ptpoUsoInmueble)
                scope.Complete()
            Catch ex As Exception
                Throw
            End Try
        End Using

        Return resultado
    End Function
    Public Shared Function Editar(ByVal descEmpresa As String, ByVal ptpoUsoInmueble As EtpoUsoInmueble) As Boolean
        Dim resultado As Boolean = False

        Dim options As New TransactionOptions
        options.IsolationLevel = Transactions.IsolationLevel.ReadCommitted
        options.Timeout = New TimeSpan(0, 2, 0)

        Using scope As New TransactionScope(TransactionScopeOption.Required, options)
            Try
                resultado = DtpoUsoInmueble.Editar(descEmpresa, ptpoUsoInmueble)
                scope.Complete()
            Catch ex As Exception
                Throw
            End Try
        End Using

        Return resultado
    End Function
    Public Shared Function Eliminar(ByVal descEmpresa As String, ByVal ptpoUsoInmueble As EtpoUsoInmueble) As Boolean
        Dim resultado As Boolean = False

        Dim options As New TransactionOptions
        options.IsolationLevel = Transactions.IsolationLevel.ReadCommitted
        options.Timeout = New TimeSpan(0, 2, 0)

        Using scope As New TransactionScope(TransactionScopeOption.Required, options)
            Try
                resultado = DtpoUsoInmueble.Eliminar(descEmpresa, ptpoUsoInmueble)
                scope.Complete()
            Catch ex As Exception
                Throw
            End Try
        End Using

        Return resultado
    End Function

End Class
